package views.menu.tents;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import controllers.GamePanel;

@SuppressWarnings("serial")
public class TentsMenu extends JPanel {
	
	public GamePanel gp;
	
	private ImageIcon imageBasicSpeedTentAux = new ImageIcon(getClass().getResource("/TentButtonTest.png"));
	private ImageIcon imageAddTroopAux = new ImageIcon(getClass().getResource("/images/entities/troop/movement/TroopMovementALeft.png"));
	
	
	BasicSpeedTentButton basicSpeedTentButton;
	BasicHealthTentButton basicHealthTentButton;
	BasicAttackTentButton basicAttackTentButton;
	BasicDefenseTentButton basicDefenseTentButton;
	BasicResourceTentButton basicResourceTentButton;
	AddTroopButton addTroopButton;
	
	
	public TentsMenu(GamePanel gp){
		
		ImageIcon imageBasicSpeedTent = new ImageIcon(imageBasicSpeedTentAux.getImage().getScaledInstance(50, 50, Image.SCALE_AREA_AVERAGING));
		ImageIcon imageAddTroop = new ImageIcon(imageAddTroopAux.getImage().getScaledInstance(50, 50, Image.SCALE_AREA_AVERAGING));
		
		
		this.gp = gp;
		basicSpeedTentButton = new BasicSpeedTentButton(imageBasicSpeedTent, this);
		basicHealthTentButton = new BasicHealthTentButton(imageBasicSpeedTent, this);
		basicAttackTentButton = new BasicAttackTentButton(imageBasicSpeedTent, this);
		basicDefenseTentButton = new BasicDefenseTentButton(imageBasicSpeedTent, this);
		basicResourceTentButton = new BasicResourceTentButton(imageBasicSpeedTent, this);
		addTroopButton = new AddTroopButton(imageAddTroop, this);
		
		addElements();
	}
	

	private void addElements() {
		 
		this.setLayout(new GridBagLayout());
		 
		GridBagConstraints constraints = new GridBagConstraints();
		 
		constraints.gridx = 0;
		constraints.gridy = 0;
		constraints.gridwidth = 1;
		constraints.gridheight = 1;
		//constraints.weightx = 8.0;
		//constraints.weighty = 0.3;
		//constraints.fill = GridBagConstraints.NONE;
		
		this.add(basicSpeedTentButton, constraints);
		
		constraints.gridx = 1;
		constraints.gridy = 0;
		constraints.gridwidth = 1;
		constraints.gridheight = 1;
		//constraints.weightx = 8.0;
		//constraints.weighty = 0.3;
		//constraints.fill = GridBagConstraints.NONE;
		
		this.add(basicHealthTentButton, constraints);
		
		constraints.gridx = 2;
		constraints.gridy = 0;
		constraints.gridwidth = 1;
		constraints.gridheight = 1;
		//constraints.weightx = 8.0;
		//constraints.weighty = 0.3;
		//constraints.fill = GridBagConstraints.NONE;
		
		this.add(basicAttackTentButton, constraints);
		
		constraints.gridx = 0;
		constraints.gridy = 1;
		constraints.gridwidth = 1;
		constraints.gridheight = 1;
		//constraints.weightx = 8.0;
		//constraints.weighty = 0.3;
		//constraints.fill = GridBagConstraints.NONE;
		
		this.add(basicDefenseTentButton, constraints);
		
		constraints.gridx = 1;
		constraints.gridy = 1;
		constraints.gridwidth = 1;
		constraints.gridheight = 1;
		//constraints.weightx = 8.0;
		//constraints.weighty = 0.3;
		//constraints.fill = GridBagConstraints.NONE;
		
		this.add(basicResourceTentButton, constraints);
		
		constraints.gridx = 2;
		constraints.gridy = 1;
		constraints.gridwidth = 1;
		constraints.gridheight = 1;
		//constraints.weightx = 8.0;
		//constraints.weighty = 0.3;
		//constraints.fill = GridBagConstraints.NONE;
		
		this.add(addTroopButton, constraints);
				
	}

}
